<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title></title>
    <style>
        html,body{
            margin: 0 auto;
            padding: 0 0;
            height:100%;
        }
    </style>
    <script>

        window.frames["result"].contentDocument.oncontextmenu = function(){ return false; };

        document.onkeydown = function() {
            var e = window.event || arguments[0];
            if (e.keyCode == 123) {
                return false;
            }
        }

        document.oncontextmenu = function() {
            return false;
        }
        document.onkeydown = function() {
            if ((e.ctrlKey) && (e.keyCode == 83)) { //ctrl+s
                return false;
            }
        }

        function load() {
            document.getElementById('result').src = "javascript:;";
        }

        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?4374636e68c72b96d5b58b4add27f698";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
        //             sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-pointer-lock"
    </script>
</head>
<body oncontextmenu="return false">
    <iframe width="100%"  height="100%"  src="{{$iframeUrl}}" id="result" onload="load();"  oncontextmenu="return false"
            marginwidth=0 marginheight=0 frameBorder=0 scrolling="no">
    </iframe>

    <script>
        @if(!empty($newUrl))
        var state = {
            title: document.title,
            url: "{{$newUrl}}",
            otherkey: null
        };
        history.replaceState(state, document.title, "{{$newUrl}}");
        @endif
    </script>
    <script>
        var cookie = {
            //当天剩下的毫秒数
            leftTime: function() {
                var curTamp = new Date().getTime();
                var curDate = new Date();
                //当日凌晨的时间戳,减去一毫秒是为了防止后续得到的时间不会达到00:00:00的状态
                var curWeeHours = new Date(curDate.toLocaleDateString()).getTime() - 1;
                var passedTamp = curTamp - curWeeHours;
                var leftTamp = 24 * 60 * 60 * 1000 - passedTamp;
                return leftTamp;
            },
            //n：键名,v：键值,exp：过期时间(ms)
            setCookie: function(n, v, exp) {
                var date = new Date()
                date.setTime(date.getTime() + exp);
                document.cookie = n + "=" + escape(v) +
                    ((exp == null) ? "" : ";expires=" + date.toGMTString())
            },
            //n为想要取到的键值的键名
            getCookie: function(n) {
                var reg = /\s/g;
                var result = document.cookie.replace(reg, "");
                var resultArr = result.split(";");
                for (var i = 0; i < resultArr.length; i++) {
                    var nameArr = resultArr[i].split("=");
                    if (nameArr[0] == n) {
                        return nameArr[1];
                    }
                }
            }
        };

        //生成随机id
        var guid = function() {
            function S4() {
                return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
            }
            return (S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4());
        };
        //如果guid不存在,则生成guid
        !cookie.getCookie('guid') && cookie.setCookie('guid', guid(), cookie.leftTime());
    </script>
</body>
</html>
